UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JKTtCcdYAlsr33GduFXk8aImrmIzvIxd0qye0c2EaNc=' 
WHERE 
  key_id = '0cd3134791739f48dee4ff08561deede1c2c96fd67f5094f718baf5153e1fe32' 
  AND (
    token = 'JKTtCcdYAlsr33GduFXk8aImrmIzvIxd0qye0c2EaNc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030