UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1nCIfzvWwCDFxytT5RcxBEUaZuGWTF1YhvdDpIXeBBU=' 
WHERE 
  key_id = '4d789c47f8fe689951747707a49d45a20f7a307f7ee9842ad5326e4c86418725' 
  AND (
    token = '1nCIfzvWwCDFxytT5RcxBEUaZuGWTF1YhvdDpIXeBBU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046