UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8yrgugrjBP1UG6S/WFWKEEohag7kQEgcKYy+RN2kt2A=' 
WHERE 
  key_id = '713eec11fb2612accce25a930a646743418c14c0a9483504a4fb52d39a80783e' 
  AND (
    token = '8yrgugrjBP1UG6S/WFWKEEohag7kQEgcKYy+RN2kt2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031