UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O2r+uUL28P/t9p9vdUBPJlz6Ah5tH4VM6JNFd/fedZQ=' 
WHERE 
  key_id = '4ca7399b2eebeef50868bd263d2d5c8796b3b0d37670a465a3a5d4d4bf955546' 
  AND (
    token = 'O2r+uUL28P/t9p9vdUBPJlz6Ah5tH4VM6JNFd/fedZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037