UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jNxAwnu0cnaBsFCiuDNhpzTM2ke+gPU235qFM/xY2vo=' 
WHERE 
  key_id = '20640fc0cc6332fcd2e9632463044a616d5f1dbb710f82160151533390df42df' 
  AND (
    token = 'jNxAwnu0cnaBsFCiuDNhpzTM2ke+gPU235qFM/xY2vo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043