UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'idcux+FlvVgfLA/6oQpi1OmjsdsGUaxPIxGumxNeX0w=' 
WHERE 
  key_id = '519a1b8c9b12fcd2b9ba2e0472f2fe218f12482094624230eee69bc36c0ddf0a' 
  AND (
    token = 'idcux+FlvVgfLA/6oQpi1OmjsdsGUaxPIxGumxNeX0w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031