UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qvtniQPxN2HWcvdD1H0laCMGCmavfvG4FS7T+jtMJCM=' 
WHERE 
  key_id = '44562ae5bbb4907d807f57d870e7310c83825b1398bc7f77e396a3667c83622b' 
  AND (
    token = 'qvtniQPxN2HWcvdD1H0laCMGCmavfvG4FS7T+jtMJCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024