UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uReYlwfdICrrmMvLvrHhnVZlc9OaqM9rr5SPIXdbgjs=' 
WHERE 
  key_id = '08057cd47eed6888b09fe6d2ceaff73a21589da02ac70e240ea8efaff5042074' 
  AND (
    token = 'uReYlwfdICrrmMvLvrHhnVZlc9OaqM9rr5SPIXdbgjs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031