UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oTeXuRZB1Df5Aa8H7gQ5aJ9Ami5kOPo6Ghy/pXea3Ww=' 
WHERE 
  key_id = 'f77b5b594f1c73e65bbb9affd45b58bea127b4565e8cdcc07dfebcc1851d9e18' 
  AND (
    token = 'oTeXuRZB1Df5Aa8H7gQ5aJ9Ami5kOPo6Ghy/pXea3Ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047