UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VwKN1yi+Ay4ZfS/EfT/T/g27TM+BWD68k0CsRpCV0hg=' 
WHERE 
  key_id = 'db2b8669fa75a967f13f705aff3263cbe40d843cc77681e6623293fbd71495bd' 
  AND (
    token = 'VwKN1yi+Ay4ZfS/EfT/T/g27TM+BWD68k0CsRpCV0hg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027