UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SgxF6E8jNFIE6txY9Dvknp8uFG8X8A9mc0LiEj2gYIg=' 
WHERE 
  key_id = '9f34a51014440fb2afdbe2a903f0468410c9530abc8f651a4970687b18dea0c6' 
  AND (
    token = 'SgxF6E8jNFIE6txY9Dvknp8uFG8X8A9mc0LiEj2gYIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037