UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nUJW2PmZiNrOrU3ntNm55f57HlvGOwGUo0MwMY/1axM=' 
WHERE 
  key_id = '9f740122c723aca0a6fbb8f6bc5e2a564fd97a861b35dc691f2bf0ac2cf4f90f' 
  AND (
    token = 'nUJW2PmZiNrOrU3ntNm55f57HlvGOwGUo0MwMY/1axM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040