UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B3zH6NAY62Rd1ln08k899Htz2IOApqaDsqlT/m0IfIQ=' 
WHERE 
  key_id = 'b52692d704665d8da82579f4317fbb590754f0883348f110ca4cb41f51f4a759' 
  AND (
    token = 'B3zH6NAY62Rd1ln08k899Htz2IOApqaDsqlT/m0IfIQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029