UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D5Qa+wXhzB0BIthqnpcc/CNix1vpklHg+4uAwELyCfM=' 
WHERE 
  key_id = '4ecf419c84ce4057df904b6f47a12dcae86668e87370928c21ef4229af8f59fb' 
  AND (
    token = 'D5Qa+wXhzB0BIthqnpcc/CNix1vpklHg+4uAwELyCfM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041