UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vaxMY7qRiBIpQ2YRy0UPkFzsSwE/23rOYOQo67sOtx0=' 
WHERE 
  key_id = '5d7338d92d2fe4188f0d14d74bbaf64044134db21b15c09e283189e6aaad2440' 
  AND (
    token = 'vaxMY7qRiBIpQ2YRy0UPkFzsSwE/23rOYOQo67sOtx0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024