UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BeMIF8t34gyTMi1FCLRw50Wyj00PqsbyaKeDEeKJYCw=' 
WHERE 
  key_id = 'b74acef245900a5892090cf6976ac9d63227f7a752d27713f028c3dde5d64ceb' 
  AND (
    token = 'BeMIF8t34gyTMi1FCLRw50Wyj00PqsbyaKeDEeKJYCw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047