UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UpgeZbtDhdKdhXMIUyWmD/RP9kyRuHRXs4u7TExV9Jc=' 
WHERE 
  key_id = '4be618f0dfdf3919f66dca70eeab42e5061fae1187cee016af886a2a3be03eb2' 
  AND (
    token = 'UpgeZbtDhdKdhXMIUyWmD/RP9kyRuHRXs4u7TExV9Jc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028