UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd6jn31OVpnQjEQszU+Ehrm5Dd2l3TSYbW6/476BZiwg=' 
WHERE 
  key_id = 'a0164f2bb5e7616ebdf0e6de32c9a060446cd4228513e2d3653d83512a473bb4' 
  AND (
    token = 'd6jn31OVpnQjEQszU+Ehrm5Dd2l3TSYbW6/476BZiwg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025