UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lgAnRmhOmu37oW93H9dFbXKTE9j7T8O4QsKYyvQBNQQ=' 
WHERE 
  key_id = 'd5084a6bb624cc2fc64accc0e386dce2ffba7c194d926da21459847b052de760' 
  AND (
    token = 'lgAnRmhOmu37oW93H9dFbXKTE9j7T8O4QsKYyvQBNQQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054