UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't4hmGrd51D+CMxYmprDQRlxuWMy6bIuRfn26pa0zS10=' 
WHERE 
  key_id = 'a6705f2213bf5764d3f10a986a52150ef9ed6d7f6c0b84c491dedfe71fd2c649' 
  AND (
    token = 't4hmGrd51D+CMxYmprDQRlxuWMy6bIuRfn26pa0zS10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028