UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L55XirsaPLzqilqir8VLEJDi+ccK+V03NQ0DNsL7WX4=' 
WHERE 
  key_id = 'd06f09238506d9d98cfd14a137b1a62996f26695dc595dd3c6fdbbf8a286288d' 
  AND (
    token = 'L55XirsaPLzqilqir8VLEJDi+ccK+V03NQ0DNsL7WX4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031