UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pIfUShmYMduux73zP+A0+b/mGirdz/9aYNR37v3k+dY=' 
WHERE 
  key_id = '5e977901afce16864e0b816cc032cda00d42838e660bc329ce3e660536f712bd' 
  AND (
    token = 'pIfUShmYMduux73zP+A0+b/mGirdz/9aYNR37v3k+dY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040