UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JI12PkOxs9zRbVu8F/FoYvuA/RWx+tncrFPyz+6o4i4=' 
WHERE 
  key_id = '3e6707419c879e49f0de7b0eac776bf33618028cea66ff470fc85a7322f4f6f0' 
  AND (
    token = 'JI12PkOxs9zRbVu8F/FoYvuA/RWx+tncrFPyz+6o4i4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022