UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'So+G9bz3FCQQgJJmP2EMa+XbkTI46b+eQqrPfYusFlw=' 
WHERE 
  key_id = '6f4bee3fcb3754ba9569edd734e5809027d33ad538cfb24cffa6de09fc5271d6' 
  AND (
    token = 'So+G9bz3FCQQgJJmP2EMa+XbkTI46b+eQqrPfYusFlw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022