UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lRPnBs4Ba9khlgRDAKMpe3QfIz9w0Oz0JK71HcMj64U=' 
WHERE 
  key_id = '387dc714cb06c7593dba66f12f489bca1398a415ef2a4905b6fb5d42c7071165' 
  AND (
    token = 'lRPnBs4Ba9khlgRDAKMpe3QfIz9w0Oz0JK71HcMj64U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026