UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tj5/H8KNdEK7U27DnepobI8R+OPVKQrw4N99ZEOpwsk=' 
WHERE 
  key_id = '242a4b22e03375ad8a478133c02fab626cf3032bb90229814a6ba4e6822a1b15' 
  AND (
    token = 'tj5/H8KNdEK7U27DnepobI8R+OPVKQrw4N99ZEOpwsk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023