UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x8Iyhvam9b0387iTR5rSL4woNCMlpdKRO0ulGmRNsqE=' 
WHERE 
  key_id = '9de17cfd23776f220ea937b6d694fbdb7273e5a0156017783660dac382492fba' 
  AND (
    token = 'x8Iyhvam9b0387iTR5rSL4woNCMlpdKRO0ulGmRNsqE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030