UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sv/lYcDBumcE1tloP/k0BpUVYpjdry1ZQw93rTXQTs0=' 
WHERE 
  key_id = 'fa4c1e4e640da39b06a68d42c6cfb9a104e1d50bf665125fb8503a7805bcbbcc' 
  AND (
    token = 'Sv/lYcDBumcE1tloP/k0BpUVYpjdry1ZQw93rTXQTs0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038