UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yMJFQQKrLCDriXYr27izWkoLq5vIsBR+rSSMqE1PpmI=' 
WHERE 
  key_id = '1e150e7f8abfdbb9f2939bd45d5f5033eab19882554b576bcf48474fea9aa771' 
  AND (
    token = 'yMJFQQKrLCDriXYr27izWkoLq5vIsBR+rSSMqE1PpmI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030