UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'msefKQuYC2xleqV4EvV4+R9yXFezHg6lkdRslsU5hHI=' 
WHERE 
  key_id = 'c862982e996546f30dbeec586b228ee510b5f795203c555d78d4eec84016737e' 
  AND (
    token = 'msefKQuYC2xleqV4EvV4+R9yXFezHg6lkdRslsU5hHI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050