UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EEilznzFWDK2cAopxwU9Nt46CZhmDtEAk5YjAJ0m5OE=' 
WHERE 
  key_id = '3308f17a942834e52be22ca6993e57b6e6dbf7128cb523cc7541b32a28d91536' 
  AND (
    token = 'EEilznzFWDK2cAopxwU9Nt46CZhmDtEAk5YjAJ0m5OE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044