UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UbAAMamloc/nKMTd4glbaWHV7Uq/VkG74JLdt/vqsIg=' 
WHERE 
  key_id = 'a224d2157093823b0d16149397ae6c927ee8f3e56b140005539943cd5d0f0dc4' 
  AND (
    token = 'UbAAMamloc/nKMTd4glbaWHV7Uq/VkG74JLdt/vqsIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040