UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YN18+x5+KqfeD+M7NdjxWTNAJZxS2b11iov0XNGi0QM=' 
WHERE 
  key_id = '8287e209ee5c820b3dc831124358378927cbd1770961bf8a90c74e259fb0c971' 
  AND (
    token = 'YN18+x5+KqfeD+M7NdjxWTNAJZxS2b11iov0XNGi0QM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042